import { io } from "socket.io-client";
import { useTokenStore } from "@/store";
const store = useTokenStore();
let socket: any;
// let count = ref<number>(0);
export function socketInstance(token: string, userId: string) {
  socket = io(import.meta.env.VITE_SOCKET_API_URL, {
    transports: ["websocket"],
    // upgrade: false,
    query: {
      token: token,
      userId: userId,
    },
  });
  return socket;
}
export function getSocket() {
  return socket;
}
export function setSocket() {
  // import { socketInstance } from "@/utils/socket";
  const socket = socketInstance(store.token, "1");
  // let socket = getSocket();
}
